#ifndef SMARTHOME_H
#define SMARTHOME_H

#include <QWidget>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include "music.h"
#include "weather.h"
#include <QTimer>
#include <QString>
#include <QTime>

namespace Ui {
class smarthome;
}

class smarthome : public QWidget
{
    Q_OBJECT

public:
    explicit smarthome(QWidget *parent = nullptr);
    ~smarthome();

    void slotLoadSerialPort();
    void slotCloseSerialPort();
    void slotSend(QString info);
    void slotOpenSerialPort();
    void timerEvent(QTimerEvent *event);
    void paintEvent(QPaintEvent *event);
private slots:
    void slotReadData();

    void on_pushButton_clicked();

    void on_pushButton_weather_clicked();

    void on_pushButton_music_clicked();

    void updateTime();  //时间更新槽函数

    void on_pushButton_kongtiao_clicked();

    void on_pushButton_light_clicked();

private:
    Ui::smarthome *ui;
    QSerialPort * m_serialPort;
    music *yinyue;
    weather * tianqi;
    QTimer *timer;
    bool isopen=true;
    bool kt=true;
    bool deng=true;
};

#endif // SMARTHOME_H
